package com.fast.alden.admin.security.service;

import org.springframework.security.core.Authentication;
import org.springframework.security.web.access.intercept.RequestAuthorizationContext;

import java.util.function.Supplier;

/**
 * 动态鉴权服务类
 */
public interface DynamicAuthorizationService {
    /**
     * 判断authentication是否有权限访问指定请求
     *
     * @param authentication 认证信息，可确定当前用户
     * @param context        请求上下文
     * @return 是否可访问
     */
    boolean check(Supplier<Authentication> authentication, RequestAuthorizationContext context);
}
